/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mlu.jdbc.simple.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author Mlungisi Sincuba
 * @since 1.0
 */
public class StringUtils {
    
    private static Logger logger = LoggerFactory.getLogger(StringUtils.class);
    
    /**
     * 
     * Removes all trailing white spaces and new lines
     * 
     * 
     * @param s
     * @return string without trailing white spaces and new lines.<br/>
     * Blank if s is null or empty.
     */
    public static String chomp(String s) {
        if (s == null || "".equals(s)) {
            return "";
        }
        s = s.replaceAll(" ", "");
        s = s.replaceAll("\r", "");
        s = s.replaceAll("\n", "");
        return s;
    }
}
